package io.renren.modules.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.admin.dao.AboutUsDao;
import io.renren.modules.admin.entity.AboutUsEntity;
import io.renren.modules.admin.service.AboutUsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("aboutUsService")
public class AboutUsServiceImpl extends ServiceImpl<AboutUsDao, AboutUsEntity> implements AboutUsService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String title =(String) params.get("title");

        QueryWrapper<AboutUsEntity> aboutUsEntityQueryWrapper = new QueryWrapper<>();
        aboutUsEntityQueryWrapper.like(StringUtils.isNotBlank(title),"title",title);

        IPage<AboutUsEntity> page = this.page(new Query<AboutUsEntity>().getPage(params),aboutUsEntityQueryWrapper );
        return new PageUtils(page);
    }

}